---
title: clsProviderAddressCollection
summary: API reference for clsProviderAddressCollection.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-08-21
library: SAIF.Business.View.Provider
reference_type: embedded
---

# clsProviderAddressCollection

`clsProviderAddressCollection` loads all addresses for a provider location and implements the primary-address selection logic consumed by `clsProviderLocation.Addresses`/`ActiveAddresses` and by `clsCaseCost`'s payee-address resolution. It is the concrete home of the address-type fallback chain: when a location has no address of the exact requested type, the collection substitutes the next-best type rather than returning nothing.

## Purpose
- Filters loaded addresses to those active on a given date (or today by default) by testing the date against each address's start/termination window ([BR-PADR-002](../../business-rules.md#br-padr-002-address-active-on-date-determination)).
- Implements the primary-address fallback chain by type: Correspondence → Physical; Payment → Physical → Correspondence; Physical → Correspondence ([BR-PADR-003](../../business-rules.md#br-padr-003-primary-address-fallback-chain)).
- Guarantees callers never receive `Nothing` from primary-address resolution — an empty `clsProviderAddress` is returned when no address of any fallback type exists ([BR-PADR-004](../../business-rules.md#br-padr-004-empty-address-returned-when-none-match)).

## Context
- Namespace: `SAIF.Business.View.Provider`
- Assembly/package: `SAIF.Business.View.Provider` (embedded/project-compiled); also distributed as the NuGet package `SAIF.BOF.Business.View.Provider`.

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `GetProviderAddressCollection` | `Shared Function GetProviderAddressCollection(dpi As IDataPortalInfo, providerLocationID As Decimal) As clsProviderAddressCollection` | Loads all address rows for a location, applying open-ended expiration handling per row ([BR-PADR-001](../../business-rules.md#br-padr-001-addresses-without-expiration-default-to-date-maxvalue)) (OP-04). |
| `CorrespondenceAddress` | `ReadOnly Property CorrespondenceAddress As clsProviderAddress` | Returns the correspondence address, falling back to Physical if no correspondence address exists ([BR-PADR-003](../../business-rules.md#br-padr-003-primary-address-fallback-chain)). |
| `PaymentAddress` | `ReadOnly Property PaymentAddress As clsProviderAddress` | Returns the payment address, falling back to Physical then Correspondence ([BR-PADR-003](../../business-rules.md#br-padr-003-primary-address-fallback-chain)). |
| `PhysicalAddress` | `ReadOnly Property PhysicalAddress As clsProviderAddress` | Returns the physical address, falling back to Correspondence if none exists ([BR-PADR-003](../../business-rules.md#br-padr-003-primary-address-fallback-chain)). |
| `PrimaryAddress` | `Function PrimaryAddress(addressType As AddressTypes) As clsProviderAddress` | Returns the best-available address of the requested type per the fallback chain, or an empty address if none exists ([BR-PADR-003](../../business-rules.md#br-padr-003-primary-address-fallback-chain), [BR-PADR-004](../../business-rules.md#br-padr-004-empty-address-returned-when-none-match)). |
| `ActiveAddresses` | `Function ActiveAddresses() As clsProviderAddressCollection` | Returns the subset of addresses active as of today ([BR-PADR-002](../../business-rules.md#br-padr-002-address-active-on-date-determination)). |
| `ActiveAddresses` | `Function ActiveAddresses(asOfDate As Date) As clsProviderAddressCollection` | Returns the subset of addresses active as of the supplied date ([BR-PADR-002](../../business-rules.md#br-padr-002-address-active-on-date-determination)). |
| `Item` | `Default ReadOnly Property Item(index As Integer) As clsProviderAddress` (from `clsBusinessCollection(Of clsProviderAddress)`) | Returns the address at the given position in the loaded collection. |
| `Count` | `ReadOnly Property Count As Integer` (from `clsBusinessCollection(Of clsProviderAddress)`) | Number of address rows loaded for the location. |
| `IsValid` | `ReadOnly Property IsValid As Boolean` (overridden from collection base) | Reflects aggregate rule-check state of member addresses; not used to gate any write since none exist. |
| `IsDirty` | `ReadOnly Property IsDirty As Boolean` (overridden from collection base) | Indicates in-memory changes to member addresses; has no effect on persistence ([BR-DATA-001](../../business-rules.md#br-data-001-no-write-operations-are-supported)). |
| `Save` | `Function Save() As clsProviderAddressCollection` (overridden from collection base) | Calls `ApplyEdit()`/`MyBase.Save()` but cannot persist since no write SQL exists ([BR-DATA-001](../../business-rules.md#br-data-001-no-write-operations-are-supported)).* |

## Behavioral notes
- OP-04: `BeforeRetrieve` sets `SQLStatement = clsProviderAddress.RETRIEVE_SQL` (SQL-PADR-01) and binds `:ProviderLocationID`; `AfterRetrieve` iterates the reader, creating and `Load()`-ing one `clsProviderAddress` per row.
- `CalculatePrimaryAddress(addressType)` is the internal engine backing `CorrespondenceAddress`, `PaymentAddress`, `PhysicalAddress`, and `PrimaryAddress`, applying the type-specific fallback chain before returning an empty address as the last resort ([BR-PADR-003](../../business-rules.md#br-padr-003-primary-address-fallback-chain), [BR-PADR-004](../../business-rules.md#br-padr-004-empty-address-returned-when-none-match)).

## Constraints and usage notes
- Callers can rely on `PrimaryAddress`/`CorrespondenceAddress`/`PaymentAddress`/`PhysicalAddress` never returning `Nothing`, simplifying downstream null checks ([BR-PADR-004](../../business-rules.md#br-padr-004-empty-address-returned-when-none-match)).
- The collection cannot persist any change to its member addresses ([BR-DATA-001](../../business-rules.md#br-data-001-no-write-operations-are-supported)).

> **Note:** Statements marked with `*` were inferred from code structure, naming
> conventions, or contextual evidence where direct confirmation was not available
> in source artifacts. Statements marked with `**` could not be confirmed; treat
> as unknown until verified.

## Sources
- SAIF.Business.View.Provider/clsProviderAddressCollection.vb
